BitsIO
 
 
 Bean BitsIO
 
General Multi-Bits Input/Output (1-8 bits)

Typical usage of the bean in user's code.

Typical Usage:

Required bean name is "Bits1". List of used pin from the port contents four items.
Examples of a typical usage of this bean follow:

(1)
The direction of the bean is set to input.

 MAIN.C

void main(void)
{
  /* Wait until "1010" is on the pins */
  while( Bits1_GetVal() != 10 );
    :
}

(2)
The direction of the bean is set to output.

 MAIN.C

void main(void)
{
  Bits_PutVal(10);    // "1010" is on the pins
  for (;;) {
    Bits1_NegBit(3);  // Invert output level of fourth pin
  }
}

(3)
The direction of the bean is set to input/output.

 MAIN.C

void main(void)
{
  Bits1_SetDir(FALSE);  // Set input mode

  /* Wait until "1111" is on the pins */
  while( Bits1_GetVal() != 15 );
  
  Bits1_SetDir(TRUE);   // Set output mode

  Bits_PutVal(0);       // Set "0000" on the pins
}

For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.


Processor ExpertTM and Embedded BeansTM are registered trademarks of UNIS, Ltd.
©1997-2005, UNIS, Ltd.